package com.yzq.authorization.server.exception;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import java.io.IOException;

/**
 * @author: yangjie.deng@resico.cn
 * @since: 2024-01-30 11:50:41
 * @version: v1.0.0
 * @describe:
 */
@Slf4j
public class CustomerAccessDeniedHandler implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
        log.error("自定义没有权限异常:{}", request.getUserPrincipal(), accessDeniedException);


    }
}
